using System.Collections.Generic;
using UnityEngine;

public class MBattleUIViewController : BattleUIViewController, IMBattleUI
{
    private MBattleController MBattleController => this.battleScene.battleController as MBattleController;

    public override void OnClickLevelList()
    {
        GameDebug.Log("OnClickLevelList");

        var mapList = battleScene.battleSceneNav.LoadDisplay<MMapListViewController>(null, false);
        MapListPanelData mapListPanelData = new MapListPanelData();
        
        mapListPanelData.itemDatas = new List<MapListItemData>(10);
        for (int i = 1; i <= Game.Instance.battleDataConfig.loopMaxLevel; i++)
        {
            //if (i <= Game.Instance.user.level)
            {
                mapListPanelData.itemDatas.Add(new MapListItemData()
                {
                    level = i,
                    active = true,
                    star = Game.Instance.user.GetStar(i)
                });
            }
            //else
            //{
            //    mapListPanelData.itemDatas.Add(new MapListItemData()
            //    {
            //        level = i,
            //        active = false,
            //        star = Game.Instance.user.GetStar(i)
            //    });
            //}
        }
        
        mapList.Init(mapListPanelData);
    }

    public void OnOptMove(Vector2 offset)
    {
        MBattleController.OptPlayerMove(offset);
    }

    public void OnOptStay(Vector2 pos)
    {
        
    }

    public void OnOptStop()
    {
        MBattleController.OptPlayerStopMove();
    }  
    
    public void OnOptAttack()
    {
        MBattleController.OptPlayerAttack();
    }


    public void OnOptSkill()
    {
        GameDebug.Log("OnOptSkill");
    }


}